﻿using EntityModel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using static EntityModel.Employee;

namespace 党务监管系统.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class EmployeeController : ControllerBase
    {
        private readonly PwsDbContext _db;
        public EmployeeController(PwsDbContext db)
        {
            _db = db;
        }
        /// <summary>
        /// 查询全部
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Result Get()
        {
            Result result = new Result();
            result.Data = _db.employee.ToList();
            return result;
        }
        /// <summary>
        /// 条件查询
        /// </summary>
        /// <param name="postion"></param>
        /// <returns></returns>
        [HttpGet]
        public Result Get1(Selectionreturnmethod postion )
        {
            Result result = new Result();
            result.Data = _db.employee.Where(w => w.Postion == postion).ToList();
            return result;
        }
    }
}
